/*
 * terminator.cpp
 *
 *  Created on: Oct 16, 2013
 *      Author: m
 */

#include <iostream>
#include <cstdlib>
#include "DefinicionesComunes.h"
#include "NewMessageQueue.h"
#include "NewSemaphore.h"
#include "NewSharedMemory.h"
#include "Sequence.h"
#include "CPrinter.h"

using namespace ipc;

int main( int argc, char* argv[] )
{
    CPrinter::setHeader( "terminator" );

    // Destruyo todos los IPCs
    SharedMemory<int>::destroy( IPC_BASE_FILE, SHM_CONT_EQUIPAJE );
    SharedMemory<int>::destroy( IPC_BASE_FILE, SHM_CONT_SOSPECHOSO );

    Semaphore::destroy( IPC_BASE_FILE, MUTEX_CONT_EQUIPAJE );
    Semaphore::destroy( IPC_BASE_FILE, MUTEX_CONT_SOSPECHOSO );

    MessageQueue<MensajeEquipaje>::destroy( IPC_BASE_FILE, MQ_SIN_VERIF );
    MessageQueue<MensajeEquipaje>::destroy( IPC_BASE_FILE, MQ_SOSPECHOSO );
    MessageQueue<MensajeEquipaje>::destroy( IPC_BASE_FILE, MQ_VERIFICADO );
    MessageQueue<int>::destroy( IPC_BASE_FILE, MQ_NOTIFICACIONES );

    Sequence::destroy( IPC_BASE_FILE, SEQ_ID_PASAJERO );
    Sequence::destroy( IPC_BASE_FILE, SEQ_ID_EST_VERIF );
    Sequence::destroy( IPC_BASE_FILE, SEQ_ID_ROBOT );

    //Nota: los procesos se mueren solos al destruir sus IPCs

    return 0;
}
